import Vue from 'vue'
import VueRouter from 'vue-router' 
import Layout from '@/views/layout/Index.vue'
import Login from "@/views/login/Index.vue"
import Home from '@/views/home/Home.vue'

import Course from '@/views/course/Course.vue'
import Data from '@/views/data/Index.vue'
import Tel from  '@/views/tel/Index.vue'
import Center from '@/views/center/Center.vue'
import Homework from'@/views/homework/Index.vue'
import Doing from '@/views/homework/list/Doing.vue'
import Done from '@/views/homework/list/Done.vue'
import All from '@/views/homework/list/All.vue'
import Correct from '@/views/homework/list/Correct.vue'
import Fabu from '@/views/fabu/Index.vue'
import Shlist from '@/views/hlist/Shlist.vue'
import Pigai from '@/views/pigai/Index.vue'


Vue.use(VueRouter)

const routes = [
    {
        path:'/layout',
        component:Layout,
        children:[
            {
                path:'home',
                name:'home',
                component:Home
            },
            {
                path:'course',
                name:'course',
                component:Course
            },
            {
                path:'homework',
                name:'homework',
                component:Homework,
                props: (route) => ({
                    courseclassS: route.query.courseclassS
                }),
                children:[
                    {
                                path:'all',
                                name:'homeworkAll',
                                component:All,
                                props: (route) => ({
                                    courseclassS: route.query.courseclassS
                                }),
                            },
                            {
                                path:'doing',
                                name:'doing',
                                component:Doing,
                                props: (route) => ({
                                    courseclassS: route.query.courseclassS
                                }),
                            },
                            {
                                path:'done',
                                name:'done',
                                component:Done,
                                props: true
                            },
                            {
                                path:'correct',
                                name:'correct',
                                component:Correct,
                                props: (route) => ({
                                    courseclassS: route.query.courseclassS
                                }),
                            }
                            
                    
                        
                    
                        
                    ]
                    
                
            },
           
            {
                path:'data',
                name:'data',
                component:Data
            },
            {
                path:'tel',
                name:'tel',
                component:Tel
            },
            {
                path:'center',
                name:'center',
                component:Center
            },
            {
                path:'fabu',
                name:'fabu',
                component:Fabu
            }
            ,
            {
                path:'shlist',
                name:'shlist',
                component:Shlist,
                props: route => ({
                    homeworkId: route.query.homeworkId,
                    courseclassS: route.query.courseclassS
        
                })
            },
            {
                path:'pigai',
                name:'pigai',
                component:Pigai,
                props:router=>({
                    finishId:router.query.finishId
                
                })
             
            }

        ]
    },
    {
        path:'/',
        name:'login',
        component:Login
    }
]

const router = new VueRouter({
    mode:'history',
    base:process.env.BASE_URL,
    routes
})

export default router